package com.fysports.web.kit.dtgrid;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.List;
import java.util.Map;


/**
 * 前端表格控件需要用到的vo实体类； <br/>
 * Created by konbluesky <br/>
 * Date : 15/11/16 下午12:50 <br/>
 * Project : jdmdataServer
 * API说明: http://www.dtgrid.com/dtGrid/doc/i18n/zh-cn/reference.html#3.5.1
 */
public class DTGridView {
    /**
     * 用途：高级查询的查询参数合集，将由组件根据用户选择自行生成。<br/>
     */
    private List<Condition> advanceQueryConditions;
    /**
     * 用途：高级查询的排序参数合集，将由组件根据用户选择自行生成。<br/>
     */
    private List<Sort> advanceQuerySorts;
    /**
     * 用途：是否导出全部数据，将由组件根据用户选择自行处理。<br/>
     */
    private boolean exportAllData = false;
    /**
     * 用途：导出的列集合，将由组件根据用户选择自行处理。<br/>
     */
    private List<Column> exportColumns;
    /**
     * 用途：导出的数据是否已经被处理。<br/>
     * 该属性为前后台的一个数据处理标识，经由resolution、数据格式化等操作完成处理的数据被视为已处理。<br/>
     */
    private boolean exportDataIsProcessed;
    /**
     * 用途：高级查询的查询参数合集，将由组件根据用户选择自行生成。<br/>
     */
    private String exportFileName;
    /**
     * 用途：导出的文件类型，将由组件根据用户选择自行处理。<br/>
     */
    private String exportType;
    /**
     * 用途：展示的数据结果集。<br/>
     */
    private List<?> exhibitDatas;
    /**
     * 用途：导出的数据集合，将由组件根据用户选择自行生成，生成的导出数据均为处理后的数据。<br/>
     */
    private List<Map<String, Object>> exportDatas;
    /**
     * 用途：快速查询的参数合集，将由组件根据用户选择自行生成。<br/>
     */
    private Map<String, Object> fastQueryParameters;
    /**
     * 用途：用于判断前台的交互信息是否为导出的动作。<br/>
     */
    private boolean isExport;
    /**
     * 用途：数据是否加载成功，若查询SQL出现错误或高级查询中配置错误，则该返回值为false，正确查询则为true。<br/>
     */
    private boolean isSuccess;
    /**
     * 用途：当前页号。<br/>
     * 特殊说明：该参数可以手动修改。
     */
    private int nowPage;
    /**
     * 用途：当前查询的纪录总页数。 <br/>
     */
    private int pageCount;
    /**
     * 用途：每页的显示的记录条数。<br/>
     */
    private int pageSize;
    /**
     * 用途：自定义参数集合。该参数可通过Javascript手动设置，属性类型为Object对象。<br/>
     * 可以通过Javascript设置参数，设置完成后通过服务器端封装的Pager对象访问对象中的parameters属性即可获得对应参数集合，<br/>
     * 该集合对应Java服务器为Map对象。
     */
    private Map<String, Object> parameters;
    /**
     * 用途：当前查询的纪录总数。<br/>
     */
    private int recordCount;
    /**
     * 用途：开始的记录号。<br/>
     */
    private int startRecord;


    /**
     * 默认初始化数据
     */
    public DTGridView() {
        this.advanceQueryConditions = Lists.newArrayList();
        this.advanceQuerySorts = Lists.newArrayList();
        this.exportAllData = false;
        this.exportColumns = Lists.newArrayList();
        this.exportDataIsProcessed = false;
        this.exportFileName = "exportfilename";
        this.exportType = "";
        this.exhibitDatas = Lists.newArrayList();
        this.exportDatas = Lists.newArrayList();
        this.fastQueryParameters = Maps.newHashMap();
        this.isExport = false;
        this.isSuccess = false;
        this.nowPage = 1;
        this.pageCount = 0;
        this.pageSize = 0;
        this.parameters = Maps.newHashMap();
        this.recordCount = 0;
        this.startRecord = 0;
    }


    public List<Condition> getAdvanceQueryConditions() {
        return advanceQueryConditions;
    }


    public void setAdvanceQueryConditions(List<Condition> advanceQueryConditions) {
        this.advanceQueryConditions = advanceQueryConditions;
    }


    public List<Sort> getAdvanceQuerySorts() {
        return advanceQuerySorts;
    }


    public void setAdvanceQuerySorts(List<Sort> advanceQuerySorts) {
        this.advanceQuerySorts = advanceQuerySorts;
    }


    public boolean getExportAllData() {
        return exportAllData;
    }


    public void setExportAllData(boolean exportAllData) {
        this.exportAllData = exportAllData;
    }


    public List<Column> getExportColumns() {
        return exportColumns;
    }


    public void setExportColumns(List<Column> exportColumns) {
        this.exportColumns = exportColumns;
    }


    public boolean getExportDataIsProcessed() {
        return exportDataIsProcessed;
    }


    public void setExportDataIsProcessed(boolean exportDataIsProcessed) {
        this.exportDataIsProcessed = exportDataIsProcessed;
    }


    public String getExportFileName() {
        return exportFileName;
    }


    public void setExportFileName(String exportFileName) {
        this.exportFileName = exportFileName;
    }


    public String getExportType() {
        return exportType;
    }


    public void setExportType(String exportType) {
        this.exportType = exportType;
    }


    public List<?> getExhibitDatas() {
        return exhibitDatas;
    }


    public void setExhibitDatas(List<?> exhibitDatas) {
        this.exhibitDatas = exhibitDatas;
    }


    public List<Map<String, Object>> getExportDatas() {
        return exportDatas;
    }


    public void setExportDatas(List<Map<String, Object>> exportDatas) {
        this.exportDatas = exportDatas;
    }


    public Map<String, Object> getFastQueryParameters() {
        return fastQueryParameters;
    }


    public void setFastQueryParameters(Map<String, Object> fastQueryParameters) {
        this.fastQueryParameters = fastQueryParameters;
    }


    /**
     * @WARN 注意使用idea 根据属性生成getter setter时，
     * boolean值类型的方法名称，ide生成getExport，实际变量名isExport，应生成getIsExport
     * @return
     */
    public boolean getIsExport() {
        return isExport;
    }


    public void setIsExport(boolean isExport) {
        this.isExport = isExport;
    }

    /**
     * @WARN 注意使用idea 根据属性生成getter setter时，
     * boolean值类型的方法名称，ide生成getSuccess，实际变量名IsSuccess，应生成getIsSuccess
     * @return
     */
    public boolean getIsSuccess() {
        return isSuccess;
    }


    public void setIsSuccess(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }


    public int getNowPage() {
        return nowPage;
    }


    public void setNowPage(int nowPage) {
        this.nowPage = nowPage;
    }


    public int getPageCount() {
        return pageCount;
    }


    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }


    public int getPageSize() {
        return pageSize;
    }


    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }


    public Map<String, Object> getParameters() {
        return parameters;
    }


    public void setParameters(Map<String, Object> parameters) {
        this.parameters = parameters;
    }


    public int getRecordCount() {
        return recordCount;
    }


    public void setRecordCount(int recordCount) {
        this.recordCount = recordCount;
    }


    public int getStartRecord() {
        return startRecord;
    }


    public void setStartRecord(int startRecord) {
        this.startRecord = startRecord;
    }
}
